﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Skywalker.Fluently.Tests.Fakes;

namespace Skywalker.Fluently.Tests.Builder_Tests
{
    [TestClass]
    public class create_and_execute_builder
    {
        [TestMethod]
        public void executes_the_specified_function()
        {
            // Arrange
            var builder = new TestComponentBuilder();
            var expectedValue = 42;

            // Act
            var returnedBuilder = builder.CreateAndExecuteBuilder(x => x.SetTestProperty(expectedValue));

            // Assert
            Assert.AreEqual(expectedValue, returnedBuilder.Component.TestProperty);
        }

        [TestMethod]
        public void returns_a_new_builder()
        {
            // Arrange
            var builder = new TestComponentBuilder();

            // Act
            var returnedBuilder = builder.CreateAndExecuteBuilder(x => x.SetTestProperty(42));

            // Assert
            Assert.IsNotNull(returnedBuilder);
        }
    }
}
